<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/include/taglibs.jsp"%>

<div id="top" style="width:100%"><c:set var="HUAXIA_MENU_REPOSITORY"
	value='${applicationScope["net.sf.navigator.menu.MENU_REPOSITORY"]}' />
<c:set var="topmenu" value='${HUAXIA_MENU_REPOSITORY.topMenus}' />


<table id="top-container" border="0" cellspacing="0" cellpadding="0" style="width:100%">
	<tr>
		<td id="top-user-panel">
		<div id="shortcut-bar">
		<div id="left">&nbsp;</div>
		<div id="center">
		<div id="hello"><bean:message key="global.userpanel.hello"
			bundle="global" />,<b>${ITEST_USER.username}</b> !</div>
		<a id="logout" href="javascript:logout();"><bean:message
			key="global.userpanel.logout" bundle="global" /></a></div>
		<div id="right">&nbsp;</div>
		</div>
		</td>
	</tr>
	<tr>
		<td 
			style="width:100%;height:36px;vertical-align: bottom; background-repeat: repeat-x; background-position: bottom;">
		
		<div id="menu" style="width:100%">
	   
		<ul class="menu">
		    
			<c:forEach var="menu" items="${topmenu}" varStatus="v">
				<c:if
					test="${empty  menu.roles or fn:contains(menu.roles,HUAXIA_CURRENT_USER.roleID)}">
					<li><a href="#" class="parent"><span>${menu.title}</span></a>
				</c:if>
				<c:set var="childMenuLength"
					value="${fn:length(menu.menuComponents)}"></c:set>
				<ul>
					<c:forEach var="childMenu" items="${menu.menuComponents}"
						varStatus="s">
						<c:if
							test="${empty  childMenu.roles or fn:contains(childMenu.roles,HUAXIA_CURRENT_USER.roleID)}">
							<c:if test="${hasChildMenu == null}">
								<c:set var="hasChildMenu" value="true"></c:set>
							</c:if>
							<c:if test="${childMenu.location==null}">
								<c:set var="menuURL"> ${pageContext.request.contextPath}${childMenu.action }</c:set>
							</c:if>
							<c:if test="${childMenu.location!=null}">
								<c:set var="menuURL"> ${ childMenu.location }</c:set>
							</c:if>
							<c:set var="submenuid">submenu_${childMenu.name}</c:set>
						</c:if>
						<c:if test="${hasChildMenu != null && s.count == childMenuLength}">
							<c:remove var="hasChildMenu" />
						</c:if>
						<li class="nfItem"><a class="parent" href="${menuURL}">${childMenu.title}</a></li>

					</c:forEach>
				</ul>
				<c:if 
					test="${empty menu.roles or fn:contains(menu.roles,HUAXIA_CURRENT_USER.roleID)}">
				</li>
				</c:if>
			</c:forEach>
			
		</ul>
		</div>
		</td>
	</tr>
</table>
</div>